package com.open.capacity.finance.controller;

import java.util.List;
import java.util.Map;

import com.open.capacity.commons.Result;
import com.open.capacity.finance.entity.SourceBaseAssetTotal;
import com.open.capacity.finance.entity.SourceBaseBusinesspay;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.security.access.prepost.PreAuthorize;
import com.open.capacity.finance.entity.SourcePz;
import com.open.capacity.finance.service.SourcePzService;

import com.open.capacity.commons.PageResult;

import javax.validation.Valid;

/**
 * 记账凭证
 *
 * @author
 * @email
 * @date 2023-01-31 16:45:00
 */
@RestController
@RequestMapping("sourcepzs")
@Api(tags = "记账凭证")
public class SourcePzController {

    @Autowired
    private SourcePzService sourcePzService;



    /**
     * 列表查询
     */
    @RequestMapping("/findAll")
    public Result findAll(@RequestParam Map<String, Object> params) {
        List<SourcePz> result = sourcePzService.findPz(params);
        return Result.succeed(result);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    @PreAuthorize("hasAnyAuthority('source_pz:sourcepz:list')")
    public PageResult list(@RequestParam Map<String, Object> params) {
        PageResult pageResult = sourcePzService.pageAll(params);
        return pageResult;
    }

    /**
     * 查询单条记录
     */
    @RequestMapping("/findById")
    @PreAuthorize("hasAnyAuthority('source_pz:sourcepz:list')")
    public Result findById(String id) {
        return Result.succeed(sourcePzService.findById(id));
    }


    /**
     * 本年的培训、会议、差旅情况
     */
    @RequestMapping("/listJjfl")
    @PreAuthorize("hasAnyAuthority('source_pz:sourcepz:list')")
    public Result listJjfl(@RequestParam Map<String, Object> params) {
        List<SourcePz> list = sourcePzService.findJjflkms(params);
        return Result.succeed(list);
    }
}
